<!DOCTYPE html>
<html>
<head lang="en">
  <meta charset="UTF-8">
  <title>${title}</title>
  <link rel="icon" href="${base}/images/favicon.ico" type="/image/x-icon" />
	<link rel="stylesheet" href="${base}/css/common.css">
    <link rel="stylesheet" href="${base}/css/admin.css">
    <script type="text/javascript" src="${base}/js/common.js"></script>
    <base href="${base}/admin/">
</head>
<body>
<#include "/common/admin_left${type}.flt">
<div class="main">
    <div class="head">
        <div class="title"><p>房东${action}</p></div>
    </div>
    <div class="single"  id="single">
        <form action="userSave"   method="post"   name="singleform" id="singleform"    >
        	<input type="hidden"  name="type"  value="${user.type}"/>
        	<input type="hidden"  name="id"  value="${user.id}"/>
            <div class="contianer">
            	<div class="body">
	                  <div class="form_control">
	                            <label><sign class="red">*</sign>姓名:</label>
	                            <div class="input">
	                            	<input name="name" id ="name" value="${user.name}"/> 
	                            </div>
	                            <span></span>
	                            <div class="clear"></div>
	                  </div>
	       			 <div class="form_control">
	                            <label><sign class="red">*</sign>联系手机:</label>
	                            <div class="input">
	                            	<input name="mobile" id ="mobile" value="${user.mobile}"/> 
	                            </div>
	                            <span></span>
	                            <div class="clear"></div>
	                  </div>
	                  
	                  <div class="form_control">
	                            <label><sign class="red">*</sign>等级:</label>
	                            <div class="input">
	                            	<select id="rank" name="rank">
	                            		<option value="">普通</option>
	                            		<option value="lv1">lv1</option>
	                            		<option value="lv2">lv2</option>
	                            		<option value="lv3">lv3</option>
	                            	</select>
	                            </div>
	                            <span></span>
	                            <div class="clear"></div>
	                  </div>
	                  <div class="form_control">
	                            <label><sign class="red">*</sign>余额:</label>
	                            <div class="input">
	                            	<input name="money" id ="money" value="${user.money}"/> 
	                            </div>
	                            <span></span>
	                            <div class="clear"></div>
	                  </div>
	                  <div class="form_control">
	                            <label><sign class="red">*</sign>备注:</label>
	                            <div class="input">
	                            	<input name="note" id ="note" value="${user.note}"/> 
	                            </div>
	                            <span></span>
	                            <div class="clear"></div>
	                  </div>
	                  <div class="complete pb30"><input id="submit" type="button"  value="保存">
	                  </div>
                  </div>
        	</div>
        </form>
    </div>
 </div>
<script src="${base}/js/jquery1.10.2.min.js" ></script>
<script src="${base}/js/jquery.form.js" ></script>
<form action="${base}/util/uploadFile" method="post" name="uploadForm" enctype="multipart/form-data" id="uploadForm" style="display: none;" >
    <input name="pic" type="file" id="pic"/>
</form>
<script>
if ("${view?if_exists}"){
	alert("保存成功!");
}
$("#rank").val("${user.rank}");
var currentPic;
jQuery(function(){
	$("#submit").click(function (){
		var options = {
            success:  showResponse1,  //处理完成的回调函数
            resetForm: true,
            //dataType:  'json'
        };
        $("#singleform").ajaxSubmit(options);
	});
    // 文件上传
    $(".btn").click(function(){
        currentPic = $(this)
        $("#pic").click();
    });
    $("#pic").change(function (){
        var fileName = $("#pic").val();
        var options = {
            success:  showResponse,  //处理完成的回调函数
            resetForm: true,
            //dataType:  'json'
        };
        $("#uploadForm").ajaxSubmit(options);

        currentPic.attr("value","重新上传");
    });

});
function showResponse(responseText){
	//alert(responseText);
	currentPic.attr("src", responseText)

	$("#"+currentPic.attr("tag")).val(responseText);	
}
function showResponse1(responseText){
	alert(responseText);
}
</script>
</body>
</html>